home *** CD-ROM | disk | FTP | other *** search
/ Hot Super Models / Hot Super Models.iso / unix / x11 / xv200.tar / xv-2.00 / pm.h < prev    next >
C/C++ Source or Header  |  1992-01-01  |  4KB  |  125 lines

  1. /* include file defining constants/macros for PM files.  Used by xvpm.c 
  2.  */
  3.  
  4. /*
  5.  * Copyright 1989, 1990, 1991 by the University of Pennsylvania
  6.  *
  7.  * Permission to use, copy, and distribute for non-commercial purposes,
  8.  * is hereby granted without fee, providing that the above copyright
  9.  * notice appear in all copies and that both the copyright notice and this
  10.  * permission notice appear in supporting documentation.
  11.  *
  12.  * The software may be modified for your own purposes, but modified versions
  13.  * may not be distributed.
  14.  *
  15.  * This software is provided "as is" without any express or implied warranty.
  16.  */
  17.  
  18. #define    PM_MAGICNO    0x56494557        /* Hex for VIEW */
  19. #define PM_MAXNELM    1024
  20. #define PM_MAXNBAND    1024
  21. #define PM_NOSHIFT    0
  22. #define PM_SHIFT    1
  23.  
  24. #define    PM_A        0x8000
  25. #define    PM_C        0x8001
  26. #define    PM_S        0x8002
  27. #define    PM_I        0x8004
  28. #define PM_F        0xc004
  29.  
  30. #define PM_RED 0xff
  31. #define PM_GREEN 0xff00
  32. #define PM_BLUE 0xff0000
  33. #define PM_ALPHA 0xff000000
  34. #define PM_BW 0
  35.  
  36. #define    PM_CMAX        0xff
  37. #define PM_SMAX        0x7fff
  38. #define    PM_IMAX        0x7fffffff
  39. #define PM_FMAX        1.7E38
  40.  
  41. #define PM_IOHDR_SIZE    (sizeof(pmpic)-(2*sizeof(char*)))
  42.  
  43. #define    pm_max(pm)    ((pm)->pm_form == PM_C ? PM_CMAX :          \
  44.                 (pm)->pm_form == PM_S ? PM_SMAX :      \
  45.                     (pm)->pm_form == PM_I ? PM_IMAX : \
  46.                          PM_FMAX)
  47.  
  48. #define pm_index(fm)    (((fm)&0xff)-(((fm)>>14)&01))
  49. #define    pm_sel(fm,fn)    (*((fn)[pm_index(fm)]))
  50. #define pm_iindex(a,nc,cr,cc)    ((a)+((cr)*(nc))+(cc))
  51.  
  52. #define pm_nelm(p)    ((p)->pm_ncol * (p)->pm_nrow)
  53. #define pm_nbelm(p)    (pm_nelm(p) * (p)->pm_nband)
  54. #define pm_psize(p)    (pm_nbelm(p) * (((p)->pm_form)&0xff))
  55. #define pm_isize(p)    ((p)->pm_np * pm_psize(p))
  56. #define pm_npix(p)      (pm_nbelm(p) * (p)->pm_np)
  57.  
  58. #include <sys/types.h>
  59.  
  60. typedef struct {
  61.     int    pm_id;        /* Magic number for pm format files.    */
  62.     int    pm_np;        /* Number of planes. Normally 1.    */
  63.     int    pm_nrow;    /* Number of rows. 1 - MAXNELM.        */
  64.     int    pm_ncol;    /* Number of columns. 1 - MAXNELM.    */
  65.     int    pm_nband;    /* Number of bands.            */
  66.     int    pm_form;    /* Pixel format.            */
  67.     int    pm_cmtsize;    /* Number comment bytes. Includes NULL. */
  68.     char    *pm_image;    /* The image itself.            */
  69.     char    *pm_cmt;    /* Transforms performed.        */
  70. } pmpic;
  71.  
  72. typedef    struct {
  73.     int    pm_x;        /* X Position. */
  74.     int    pm_y;        /* Y Position. */
  75.     int    pm_z;        /* Z Position. */
  76.     float    pm_ux;        /* Uncertainty in x. */
  77.     float    pm_uy;        /* Uncertainty in y. */
  78.     float    pm_uz;        /* Uncertainty in z. */
  79. } pmxyz;
  80.  
  81. #define    PM_EBASE    100
  82. #define PM_EMALLOC    101
  83. #define PM_EBADPARAM    102
  84. #define PM_EBADPIC    103
  85. #define PM_EBADFORM    104
  86. #define PM_EBADMAGIC    105
  87. #define PM_ENULLPIC    106    /* picture given was NULL */
  88. #define PM_EBADPLANES   107  /* invalid # of planes chosen for format */
  89. #define PM_EBADBANDS     108 /* invalid # of bands chosen for format */
  90. #define PM_EBADSIZE     109 /* # of rows/cols and x offsets, y offsets
  91.                too big for ikonas */
  92. #define PM_EBADCOLORS     110 /* invalid number of colors chosen for format */
  93. #define PM_EBADCOLORPLANE 111 /* invalid color plane entered */
  94.  
  95.  
  96. #define PM_NERROR    12
  97. #define PM_ERROR(e)    (((e) < PM_EBASE || (e) > (PM_EBASE + PM_NERROR)) ? \
  98.                 0 : (e) - PM_EBASE)
  99. extern char    *pm_errmsg[];
  100.  
  101. pmpic    *pm_add();
  102. pmpic    *pm_addcmt();
  103. pmpic    *pm_alloc();
  104. pmpic    *pm_and();
  105. pmpic    *pm_bthresh();
  106. pmpic    *pm_cast();
  107. char    *pm_cmt();
  108. pmpic    *pm_conv();
  109. pmpic    *pm_ebadform();
  110. int    pm_getcmt();
  111. pmpic    *pm_ikrd();
  112. pmpic    *pm_ikwr();
  113. pmpic    *pm_neg();
  114. pmpic    *pm_or();
  115. pmpic    *pm_prep();
  116. pmpic    *pm_rdhdr();
  117. pmpic    *pm_read();
  118. pmpic    *pm_scale();
  119. pmpic    *pm_sub();
  120. pmpic    *pm_thresh();
  121. pmpic    *pm_write();
  122.  
  123. pmxyz    *pm_centroid();
  124.  
  125.